﻿

    <div ms-controller="tempview">
        <div class="sui-form form-inline">
            <input type="text" placeholder="请输入关键词" class="input-xlarge input-xfat" ms-duplex="search.key" />
            <a class="sui-btn btn-large btn-primary" style="margin-left:10px;" ms-click="GetLIST()">查询</a>
            <a style="margin-left:10px;" class="sui-btn btn-large btn-success" ms-click="ADD('')">添加</a>
        </div>
        
    <table class="sui-table table-primary table-zebra">
  <thead>
    <tr>
      <th>用户名</th>
      <th>用户姓名</th>
      <th>手机号</th>
      <th>用户角色</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    <tr ms-repeat-el="ListData">
      <td>{{el.UserName}}</td>
      <td>{{el.UserXM}}</td>
      <td>{{el.TelePhone}}</td>
       <td>{{el.RoleName}}</td>
      <td>
          <a href="javascript:void(0);" class="sui-btn btn-bordered btn-small btn-success" ms-click="ADD(el)">修改</a>
          <a href="javascript:void(0);" class="sui-btn btn-bordered btn-small btn-danger" ms-click="DEL(el)">删除</a>
      </td>
    </tr>

  </tbody>
</table>

    <div id="pageDiv"></div>

    </div>

  <script type="text/javascript">
      var tempmodel = avalon.define({
          $id: "tempview",
          search: {key:""},
          page: { pageindex: 1, pagecount: 10 },
          ShowColumns: [],
          ListData: [],
          APINAME: "",
          Operation: "",
          GetLIST: function () {
              
              ComFunJS.getJSON("BASE_GETUSER", { pageindex: tempmodel.page.pageindex, SearchKey: tempmodel.search.key }, function (r) {
                  if (r.error == "") {
                      tempmodel.ListData = r.result;

                      $("#pageDiv").pagination({  //分页容器
                          styleClass: ['sui-pagination'],  //分页样式
                          //showCtrl: false,
                          displayPage: 6,
                          itemsCount: r.total,
                          pageSize: tempmodel.page.pagecount,
                          onSelect: function (num) {
                              tempmodel.page.pageindex = num;
                              ComFunJS.getJSON("BASE_GETUSER", { pageindex: tempmodel.page.pageindex, SearchKey: model.SearchKey }, function (r) {
                                  tempmodel.ListData.clear();
                                  tempmodel.ListData = r.result;
                              })
                          }
                      })

                      $('#pageDiv').pagination('updateItemsCount', r.total, 1);
                  }
              })
          },
          DEL: function (el) {
              ComFunJS.winShowConfirm("确认删除吗", function () {
                  ComFunJS.getJSON("BASE_DELUSER", { P1: el.ID }, function (r) {
                      tempmodel.ListData.remove(el);
                  })
              })
             
          }
      })
      avalon.ready(function () {

          tempmodel.GetLIST();
         
      })

      
  </script>
